﻿@model PagedList.IPagedList<User>
@using Resources
@using QAS.Nekorama.Models
@using PagedList.Mvc
@{
    ViewBag.Title = QAS_Nekorama.USERS;
}

<div id="primary">
    <div id="primary-1">
    </div><!--end primary-1-->
    <div id="primary-2">
        <div id="user-list">
            <div class="search-bar">
                @using (Html.BeginForm("Index", "User", FormMethod.Get, new {@id = "search"}))
                {
                    @Html.TextBox("SearchUserString", null, new {placeholder = QAS_Nekorama.SEARCH_BY_KEYWORD})
                }
            </div><!--end search-bar-->
            @{
                int count = 0;
                int flag = 0;
                int userNumber = 0;
                foreach (User item in Model)
                {
                    userNumber++;
                }
            }

            @foreach (User item in Model)
            {
                if (count%3 == 0)
                {
                    @:<div class="u-row">
                    flag = count;
                }
                <div class="user">
                    <div class="avatar">
                        <a href="@Url.Action("Details", "User", new {id = item.UserID}, null)">
                            <img src="@Html.Raw("/Images/Avatars/" + item.Avatar)" alt="nekorama user avatar" width="72" height="72" />
                        </a>
                    </div><!--end avatar-->
                    <div class="user-info">
                        <h1>@Html.ActionLink(item.DisplayName, "Details", "User", new {id = item.UserID}, null)</h1>
                        <p>@item.Location</p>
                        <br />
                        <p>@item.Reputation</p>
                    </div><!--end user-info-->
                </div>
                <!--end user-->
                count++;
                if (count%3 == 0)
                {
                    if (count != flag)
                    {
                        @:</div><!--end row-->
                    }
                }
                else if (count == userNumber)
                {
                    @:</div><!--end row-->
                }
            }
            <div id="page-number">
                @Html.PagedListPager(Model, page => Url.Action("Index", new {page, currentFilter = ViewBag.CurrentFilter}))
            </div><!--end page-number-->
        </div><!--end user-list-->
    </div><!--end primary-2-->
    <div id="primary-3">
    </div><!--end primary-3-->
</div><!--end primary-->